<template>
  <div>
    <el-row :gutter="40" class="panel-group">
      <el-col :span="8" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-tree-table">
            <svg-icon icon-class="tree-table" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              项目总数
            </div>
            <count-to :start-val="0" :end-val="panelData.projectsNum" :duration="2000" class="card-panel-num" />
          </div>
        </div>
      </el-col>
      <el-col :span="8" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-tree-table">
            <svg-icon icon-class="tree" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              工作量
            </div>
            <count-to :start-val="0" :end-val="panelData.workFinishedAmountSum" :decimals="3" :duration="2000" class="card-panel-num" />元
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row :gutter="40" class="panel-group">
      <el-col :span="8" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-money">
            <svg-icon icon-class="money" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              合同金额
            </div>
            <count-to :start-val="0" :end-val="panelData.contractAmountSum" :decimals="3" :duration="2000" class="card-panel-num" />元
          </div>
        </div>
      </el-col>
      <el-col :span="8" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-shopping">
            <svg-icon icon-class="shopping" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              决算金额
            </div>
            <count-to :start-val="0" :end-val="panelData.finalAmountSum" :decimals="3" :duration="2000" class="card-panel-num" />元
          </div>
        </div>
      </el-col>
      <el-col :span="8" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-tab">
            <svg-icon icon-class="tab" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              开票金额
            </div>
            <count-to :start-val="0" :end-val="panelData.invoiceAmountSum" :decimals="3" :duration="2000" class="card-panel-num" />元
          </div>
        </div>
      </el-col>
      <el-col :span="8" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-gonggao">
            <svg-icon icon-class="gonggao" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              到账金额
            </div>
            <count-to :start-val="0" :end-val="panelData.receivedAmountSum" :decimals="3" :duration="2000" class="card-panel-num" />元
          </div>
        </div>
      </el-col>
      <el-col :span="8" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-dashboard">
            <svg-icon icon-class="dashboard" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              剩余尾款
            </div>
            <count-to :start-val="0" :end-val="panelData.remainBalanceSum" :decimals="3" :duration="2000" class="card-panel-num" />元
          </div>
        </div>
      </el-col>
      <el-col :span="8" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-people">
            <svg-icon icon-class="peoples" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              劳务金额
            </div>
            <count-to :start-val="0" :end-val="panelData.collaborationAmountSum" :decimals="3" :duration="2000" class="card-panel-num" />元
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import CountTo from 'vue-count-to'

export default {
  components: {
    CountTo
  },
  props: {
    panelData: {
      type: Object,
      required: true
    }
  }
}
</script>

<style lang="scss" scoped>
.panel-group {
  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 92px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-tab {
        background: #9F81F7;
      }

      .icon-dashboard {
        background: #F7D358;
      }

      .icon-gonggao {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }

      .icon-tree-table {
        background: #36a3f7
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-tab {
      color: #9F81F7;
    }

    .icon-dashboard {
      color: #F7D358;
    }

    .icon-gonggao {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .icon-tree-table {
      color: #36a3f7
    }

    .card-panel-icon-wrapper {
      display: inline-block;
      margin: 12px 0 0 15px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 36px;
    }

    .el-icon-s-claim {
      font-size: 36px;
    }

    .card-panel-description {
      display: inline-block;
      font-weight: bold;
      margin: 20px;
      vertical-align: top;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width:550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
